package GOrden.mobile;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;

import com.google.android.maps.*;

public class OverlayMapa extends Overlay {

	private Double latitud;
	private Double longitud;

	public OverlayMapa(Double latitud, Double longitud) {
		super();
		this.latitud = latitud;
		this.longitud = longitud;
	}

	@Override
	public void draw(Canvas canvas, MapView mapView, boolean shadow) {
		// TODO Auto-generated method stub
		Projection projection = mapView.getProjection();
		GeoPoint geoPoint = new GeoPoint(latitud.intValue(),
				longitud.intValue());
		if (shadow == false) {
			Point centro = new Point();
			projection.toPixels(geoPoint, centro);
			// Definimos el pincel de dibujo
			Paint p = new Paint();
			p.setColor(Color.BLUE);
			// Marca Ejemplo 2: Bitmap
			Bitmap bm = BitmapFactory.decodeResource(mapView.getResources(),
					R.drawable.marker);
			canvas.drawBitmap(bm, centro.x - bm.getWidth(),
					centro.y - bm.getHeight(), p);
		}
	}

	@Override
	public boolean onTap(GeoPoint arg0, MapView arg1) {
		// TODO Auto-generated method stub
		return super.onTap(arg0, arg1);
	}

}
